package com.aierkeji.call.b2c.dao.jpa;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.aierkeji.call.b2c.dao.BaseJPADao;
import com.aierkeji.call.b2c.dao.jpa.custom.AkjCallClueDaoCustom;
import com.aierkeji.call.b2c.entity.AkjCallClue;
import com.aierkeji.call.b2c.entity.AkjCallUser;

public interface AkjCallClueDao extends BaseJPADao<AkjCallClue, String>,AkjCallClueDaoCustom{

	List<AkjCallClue> findByAssignedTo(@Param("assignedTo") AkjCallUser assignedTo);

	
	List<AkjCallClue> findByAssignedToAndAssignedAtLike(@Param("assignedTo") AkjCallUser assignedTo, @Param("assignedAt")String assignedAt);


	AkjCallClue findById(@Param("id")Long callClueId);
	
	@Query("select max(id) from AkjCallClue where phone = :phone and assignedTo.id = :assignedTo and clueGroup.id=:clueGroup")
	Long findClueId(@Param("phone")String phone ,@Param("assignedTo")Long assignedTo,@Param("clueGroup") Long clueGroup);
}
